/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.yurendao.shop.forum.service.impl;

import com.yurendao.shop.forum.domain.Comment;
import com.yurendao.shop.forum.domain.Note;
import com.yurendao.shop.forum.exception.CommentException;

/**
 *
 * @author shilin
 */
public class ForumValidate {
    public static void NullCheck(String value,String error_code){
        if(value.trim()==null||value.equals(""))
            throw new CommentException();
    }
    public static void noteCheck(Note note){
        NullCheck(note.getTitle(),"4002");
        NullCheck(note.getContent(),"4002");
        NullCheck(note.getProvince(),"4002");
        NullCheck(note.getCity(),"4002");
    }
    
    public static void commentCheck(Comment comment){
        NullCheck(comment.getContent(),"4002");
    }
}
